﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ARR.UI.Models;
using ARR.Entities;
using System.Collections.ObjectModel;
using ARR.UI.Commands;
using System.Windows.Input;

namespace ARR.UI.ViewModels
{
    public class HistoryGenerationViewModel : WorkspaceViewModel
    {
        private IHistoryGenerationModel model;
        private ICommand generateHistoryCommand;

        public HistoryGenerationViewModel(IHistoryGenerationModel model)
        {
            this.model = model;

            this.DisplayName = "Historicos";
        }

        public ICommand GenerateHistoryCommand
        {
            get
            {
                if (generateHistoryCommand == null)
                {
                    generateHistoryCommand = new RelayCommand(param => GenerateHistory());
                }
                return generateHistoryCommand;
            }
        }

        private void GenerateHistory()
        {
            model.GenerateHistory();
        }


        public ObservableCollection<HistoryDetail> History 
        {
            get
            {
                return new ObservableCollection<HistoryDetail>(model.History);
            }
        }

    }
}
